<div class="center_content">
	<div class="left_content">
		<ul class="nav nav-list">
			<li class="nav-header">
				<%= t('Category') %>
			</li>
			<% @categories.each do |category| %>
			<% if(@category.name == category.name) %>
			<li class="active">
				<% if session[:language] == 'vi'%>
				<%= link_to category.name, :controller => 'categories',:action => 'show',:id => category.id%>
				<% else %>
				<%= link_to category.description, :controller => 'categories',:action => 'show',:id => category.id%>
				<% end%>
			</li>
			<% else %>
			<li>
				<% if session[:language] == 'vi'%>
				<%= link_to category.name, :controller => 'categories',:action => 'show',:id => category.id%>
				<% else %>
				<%= link_to category.description, :controller => 'categories',:action => 'show',:id => category.id%>
				<% end%>
			</li>
			<% end %>
			<% end %>
		</ul>
	</div>

	<div class="right_content">
		<div class="search">
			<%= form_tag search_default_index_path, :method => :get,:class =>"navbar-form pull-left" do %>
			<%= select_tag :search_type, options_for_select(["Author", "Title", "ID Book"]), :class => "input-small search-filter" %>
			<%= text_field_tag :search_value, nil, :class => "search-input" %>
			<div class="search-btn">
				<%= submit_tag "Search", :class => 'btn'%>
			</div>
			<% end %>
		</div>
		<% if flash[:message]%>
		<div class="notice">
			<%= flash[:message] %>
		</div>
		<% end %>
		<div class = "bookmain">
			<div class = "category_title">
				<% if session[:language]%>
				<% if session[:language] == 'vi'%>
				<span><%= @category.name %></span>
				<% else%>
				<span><%= @category.description %></span>
				<% end%>
				<% else%>
				<span><%= @category.description %></span>
				<% end%>
				<%= link_to 'Back', :controller => 'categories',:action => 'show',:id => @category.id %>
			</div>
			<div class="bookdetail">
				<%= image_tag @book.image_url %>
				<div class= "data">
					<p class="title">
						<%= @book.title %>
					</p>

					<p class="author">
						<%= t("by") %> <%= @book.author %>
					</p>

					<table>
						<tr>
							<td>
							<div style="font-size:small;color: #666666;float:right;font-family: verdana,arial,helvetica,sans-serif;">
								<%= t("Code") %>:
							</div></td>
							<td><%= @book.code %></td>
						</tr>
						<tr>
							<td>
							<div style="font-size:small;color: #666666;float:right;font-family: verdana,arial,helvetica,sans-serif;">
								<%= t("Quantity") %>:
							</div></td>
							<td><%= @book.quantity %></td>
						</tr>
						<tr>
							<td>
							<div style="font-size:small;color: #666666;float:right;font-family: verdana,arial,helvetica,sans-serif;">
								<%= t("Remaining") %>:
							</div></td>
							<td><%= @book.current_quantity %></td>
						</tr>
						<tr>
							<td>
							<div style="font-size:small;color: #666666;float:right;font-family: verdana,arial,helvetica,sans-serif;">
								<%= t("Category") %>:
							</div></td>
							<% if session[:language]%>
							<% if session[:language] == 'vi'%>
							<td><%= @category.name %></td>
							<% else%>
							<td><%= @category.description %></td>
							<% end%>
							<% else%>
							<td><%= @category.description %></td>
							<% end%>
						</tr>
						<tr>
							<td>
							<div style="font-size:small;color: #666666;float:right;font-family: verdana,arial,helvetica,sans-serif;">
								<%= t("Price") %>:
							</div></td>
							<td><%= @book.price %></td>
						</tr>
						<tr>
							<td>
							<div style="font-size:small;color: #666666;float:right;font-family: verdana,arial,helvetica,sans-serif;">
								<%= t("Number of borrow") %>:
							</div></td>
							<td><%= @book.numborrowed %></td>
						</tr>
						<tr>
							<td>
							<div style="font-size:small;color: #666666;float:right;font-family: verdana,arial,helvetica,sans-serif;">
								<%= t("Number of view") %>:
							</div></td>
							<td><%= @book.numviewed %></td>
						</tr>
						<% if @book.current_quantity > 0%>
						<tr>
							<td></td><td><%= link_to t("Borrows"),{:controller => 'userborrow',:action => 'borrow',:bookid => @book.id}, :confirm  => 'Do you want to borrow this book'%> </td>
						</tr>
						<% else %>
						<tr>
							<td colspan='2'>
							<div style="color:#EE9400">
								Sorry, this book is unavailable
							</div></td>
						</tr>
						<% end%>
					</table>

				</div>
				<div class="description">
					<div style="border-bottom:1px solid #DDD;color:#CC6600;font-weight:bold;font-size:14px;">
						<%= t('Description') %>
					</div>
					<%= @book.description %>
				</div>
				<div class="other_book">
					<div style="border-bottom:1px solid #DDD;color:#CC6600;font-weight:bold;font-size:14px;">
						<%= t('Other books') %>
					</div>
					<% if @other_books.size > 0%>
					<ul>
						<% @other_books.each do |other_book|%>
						<li>
							<%= link_to (image_tag other_book.image_url),:controller =>'bookDetail',:action=>'show',:id => other_book.id%>
							<span> <%= link_to other_book.title,:controller =>'bookDetail',:action=>'show',:id => other_book.id%>
								<br/>
								Tác giả: <%= other_book.author %> </span>
						</li>
						<% end%>
					</ul>
					<% end%>
				</div>
			</div>
		</div>
	</div>
</div>
